<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">
        <div>对象的属性 {{info.num}} </div>
        <div>对象的属性 {{info.n}}</div>
         <button @click="add">赋值</button>
         <button @click="add1">给n赋值</button>
    </div>   
</body>
<script>
      new  Vue({
        el:"#app",
        data:{
            info:{
                num:10
            }
        },
        methods:{
            add(){
                this.info.num++;
            },
            add1(){
               // this.info.n=1; 
                //this.info.num++;添加这行代码就有效果
                this.$set(this.info,"n",11);
            }
        }  
      })
</script>
</html>